package view;

import entity.SystemM;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;

public class CentralFrame extends javax.swing.JFrame {

    public static ArrayList<SystemM> registers = new ArrayList<>();

    public CentralFrame() {
        initComponents();
        List<SystemM> reg = view.CentralFrame.registers;
        if (reg.isEmpty()) {
            HistoricoButton.setEnabled(false);
            ActualDataButton.setEnabled(false);
            OutlookViewButton.setEnabled(false);
            PronosticButton.setEnabled(false);
        }
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        IngresarButton = new javax.swing.JButton();
        HistoricoButton = new javax.swing.JButton();
        ActualDataButton = new javax.swing.JButton();
        OutlookViewButton = new javax.swing.JButton();
        PronosticButton = new javax.swing.JButton();
        ExitButton = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        IngresarButton.setLabel("Ingresar Datos");
        IngresarButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                IngresarButtonActionPerformed(evt);
            }
        });

        HistoricoButton.setLabel("Histórico de resultados");
        HistoricoButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                HistoricoButtonActionPerformed(evt);
            }
        });

        ActualDataButton.setLabel("Visualizar valores actuales");
        ActualDataButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ActualDataButtonActionPerformed(evt);
            }
        });

        OutlookViewButton.setLabel("Reporte estadístico");
        OutlookViewButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                OutlookViewButtonActionPerformed(evt);
            }
        });

        PronosticButton.setLabel("Pronóstico");
        PronosticButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PronosticButtonActionPerformed(evt);
            }
        });

        ExitButton.setText("Salir");
        ExitButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ExitButtonActionPerformed(evt);
            }
        });

        jLabel2.setFont(new java.awt.Font("URW Bookman L", 3, 15)); // NOI18N
        jLabel2.setForeground(java.awt.Color.blue);
        jLabel2.setText("Central meteorológica AguasCalientes");

        jLabel1.setFont(new java.awt.Font("URW Bookman L", 3, 15)); // NOI18N
        jLabel1.setForeground(java.awt.Color.blue);
        jLabel1.setText("Bienvenido");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 312, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(137, 137, 137)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 80, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(ActualDataButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(HistoricoButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(IngresarButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(OutlookViewButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(PronosticButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(ExitButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(41, 41, 41))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addComponent(IngresarButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(HistoricoButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ActualDataButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(OutlookViewButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(PronosticButton)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ExitButton)
                .addContainerGap(37, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void HistoricoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_HistoricoButtonActionPerformed
        HistoricView newHistoric = new HistoricView();
        newHistoric.setLocationRelativeTo(null);
        newHistoric.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_HistoricoButtonActionPerformed

    private void ActualDataButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ActualDataButtonActionPerformed
        ActualDataView newActualData = new ActualDataView();
        newActualData.setLocationRelativeTo(null);
        newActualData.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_ActualDataButtonActionPerformed

    private void ExitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExitButtonActionPerformed
        System.exit(0);
    }//GEN-LAST:event_ExitButtonActionPerformed

    private void OutlookViewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OutlookViewButtonActionPerformed
        OutlookView newOutlookView = new OutlookView();
        newOutlookView.setLocationRelativeTo(null);
        newOutlookView.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_OutlookViewButtonActionPerformed

    private void IngresarButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_IngresarButtonActionPerformed
        DataInputView input = new DataInputView(registers);
        input.setLocationRelativeTo(null);
        input.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_IngresarButtonActionPerformed

    private void PronosticButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PronosticButtonActionPerformed
        Prediction NewPrediction = new Prediction();
        NewPrediction.setLocationRelativeTo(null);
        NewPrediction.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_PronosticButtonActionPerformed

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                CentralFrame splash = new CentralFrame();
                splash.setLocationRelativeTo(null);
                splash.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton ActualDataButton;
    private javax.swing.JButton ExitButton;
    private javax.swing.JButton HistoricoButton;
    private javax.swing.JButton IngresarButton;
    private javax.swing.JButton OutlookViewButton;
    private javax.swing.JButton PronosticButton;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the SystemArray
     */
}
